<script setup>
import { useCommonStore } from '@/store/commonStore'
import { storeToRefs } from "pinia";
import eventBus from '@/utils/eventBus.js'

const { 
    isShowTipInfo, 
    tipInfoContent,
    oplationType
} = storeToRefs(useCommonStore());

const btnClick = (value) => {
    isShowTipInfo.value = false;    // 关闭信息提示框
    if (value) {    // 确定
        if (oplationType.value === 'delete') {    // 删除信息
            eventBus.emit('deleteBtnClick');
        } else if (oplationType.value === 'exit') {     // 退出系统
            eventBus.emit('exitSystem');
        } else if (oplationType.value === 'delete-more') {  // 批量删除
          eventBus.emit("deleteMoreClick")
        } else {
          eventBus.emit('determineBtnClick')
        }
    }
}

</script>

<template>
  <div class="tip_infos">
    <el-dialog
      title="温馨提示！"
      width="30%"
      v-model="isShowTipInfo"
      :show-close="false"
    >
      <span>{{ tipInfoContent }}</span>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="btnClick(0)">取消</el-button>
          <el-button type="primary" @click="btnClick(1)">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<style scoped>

</style>